import pygame

class TestBmp:
    def __init__(self, prac) -> None:
        self.screen = prac.screen

        self.image = pygame.image.load('practice.bmp')

        self.screen_rect = self.screen.get_rect()
        self.rect = self.image.get_rect()

        self.rect.center = self.screen_rect.center
        print(self.rect)

        self.moving_left = False
        self.moving_right = False
        self.moving_up = False
        self.moving_down = False

        self.x = float(self.rect.x)
        self.y = float(self.rect.y)

        self.speed = 1.5

    def blitme(self):
        self.moving()
        self.screen.blit(self.image, self.rect)

    def moving(self):
        if self.moving_left == True and self.rect.left > self.screen_rect.left:
            self.x -= self.speed
        if self.moving_right == True and self.rect.right < self.screen_rect.right:
            self.x += self.speed
        if self.moving_up == True and self.rect.top > self.screen_rect.top:
            self.y -= self.speed
        if self.moving_down == True and self.rect.bottom < self.screen_rect.bottom:
            self.y += self.speed

        self.rect.x = self.x
        self.rect.y = self.y